﻿
//提交讨论话题
function SaveTopic()
{
    if(__P_M==""){$Login$();return;}
    var valTitle = $("txtTitle").value;    
    var valDesc = "";//内容    
    try{valDesc=FCKeditorAPI.GetInstance('txtDesc').GetXHTML(true);}catch(e){}    
    if(valTitle.length<3 || valTitle.length>110)
    {
         $("ErrorTitle").style.display = "";
         return;
    }
    $("ErrorTitle").style.display = "none";     
    if(valDesc.length<3 || valDesc.length>9999)
    {
        $("ErrorDesc").style.display = "";
        return;
    }
    $("ErrorDesc").style.display = "none"; 
    $get("btnSave").disabled = true;
    showProgressBar(false,true);
    //调用webserver方法
    WebServices.WWW.Groups.AddTopic(groupID,valTitle,valDesc,onsuccOP);
}
function onsuccOP(result)
{   
    //RefHref();
    if(result.State)
    {
        top.location="/groups/"+groupID+"/topic/"+result.Msg+".htm";
    }
    $get("btnSave").disabled = false;
    showProgressBar(false,false);
}
//转向页面
function RefHref()
{
    var refer = document.referrer.toLowerCase();
    if(refer.indexOf("add-topic.htm")>-1||refer=="")
    {
        top.location = "/groups/";
    }    
    else
    {
        window.location.href = refer;
    }
}